import pygame

class SuccessScreen:
    def __init__(self, screen):
        self.screen = screen
        self.font = pygame.font.Font(None, 74)  # 创建字体对象
        self.text = self.font.render("SUCCESS!", True, (255, 255, 255))  # 渲染文字
        self.text_rect = self.text.get_rect(center=(400, 300))  # 居中放置

    def run(self):
        running = True
        while running:
            self.screen.fill((0, 0, 0))  # 背景填充黑色
            self.screen.blit(self.text, self.text_rect)  # 绘制文字
            pygame.display.flip()  # 更新显示

            for event in pygame.event.get():
                if event.type == pygame.QUIT:
                    pygame.quit()
                    exit()
                if event.type == pygame.KEYDOWN:
                    return "start"  # 按任意键返回开始菜单